home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 February / PCWorld_2007-02_cd.bin / v cisle / Addons / Addons.exe / quicknote-0.6.0.3-fx+mz+tb.xpi / install.js next >
Text File  |  2005-09-17  |  3KB  |  69 lines

  1. /* ***************
  2. Desc: Installation script
  3. Modified version of Chris Pederick installscript from WD.
  4. Author: Jed Brown (jedbro@gmx.net)
  5. Version: 0.6.x
  6. Last modified: May 25th, 2004
  7. ****************** */
  8. const author              = "Jed Brown";
  9. const displayName         = "QuickNote";
  10. const name                = "quicknote";
  11. const version             = "0.6.2";
  12. var contentFlag           = CONTENT | PROFILE_CHROME;
  13. var error                 = null;
  14. var folder                = getFolder("Profile", "chrome");
  15. var localeFlag            = LOCALE | PROFILE_CHROME;
  16. var skinFlag              = SKIN | PROFILE_CHROME;
  17. var jarName               = name + ".jar";
  18. var existsInApplication   = File.exists(getFolder(getFolder("chrome"), jarName));
  19. var existsInProfile       = File.exists(getFolder(folder, jarName));
  20. const SUCCESS_MESSAGE     = " can now be found under the Tools menu, as a toolbar icon (TB and Fx only) or accessed by the hotkey CTRL-F7 \n Please restart the application or open a new window for completion.";
  21.  
  22. initInstall(displayName, name, version);
  23.  
  24. // If the extension exists in the application folder or it doesn't exist in the profile folder and the user doesn't want it installed to the profile folder
  25. if(existsInApplication || (!existsInProfile && !confirm("Do you want to install the extension into your profile folder?\n(Cancel will install into the application folder)")))
  26. {
  27.     contentFlag = CONTENT | DELAYED_CHROME;
  28.     folder      = getFolder("chrome");
  29.     localeFlag  = LOCALE | DELAYED_CHROME;
  30.     skinFlag    = SKIN | DELAYED_CHROME;
  31. }
  32.  
  33. setPackageFolder(folder);
  34. error = addFile(author, version, 'chrome/' + jarName, folder, null);
  35. if (error == SUCCESS) {
  36.   var iconfolder = getFolder(getFolder("chrome", "icons"), "default");
  37.   //addFile(name, "ce-main.xpm", iconfolder, "");
  38.   addFile(name, "quicknote-main.ico", iconfolder, "");
  39.   addFile(name, "quicknote-main.xpm", iconfolder, "");
  40. }
  41. // If adding the JAR file succeeded
  42. if(error == SUCCESS)
  43. {
  44.     folder = getFolder(folder, jarName);
  45.     registerChrome(contentFlag, folder, "content/");
  46.     registerChrome(localeFlag, folder, "locale/en-US/");
  47.     registerChrome(localeFlag, folder, "locale/es-ES/");
  48.     registerChrome(localeFlag, folder, "locale/ru-RU/");
  49.     registerChrome(localeFlag, folder, "locale/sl-SI/");
  50.     registerChrome(skinFlag, folder, "skin/classic/");
  51.  
  52.     error = performInstall();
  53.  
  54.     // If the install failed
  55.     if(error == SUCCESS || error == 999)
  56.     {
  57.       alert(displayName+" "+version+" has been succesfully installed.\n"+displayName + SUCCESS_MESSAGE);
  58.     }else{
  59.       alert("Install failed. Error code:" + error);
  60.       cancelInstall(error);
  61.     }
  62. }
  63. else
  64. {
  65.     alert("The installation of the extension failed.\n" + error + "\n Failed to create " +jarName+ " \n"
  66.           +"Make sure you have the correct permissions");
  67.     cancelInstall(error);
  68. }
  69.